package com.edu.base.ums.metadatavalue.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.edu.base.ums.metadatavalue.domain.SysmMetadatavalue;
import com.edu.base.ums.metadatavalue.service.ISysmMetadatavalueService;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 元数据管理Controller
 * 
 * @author admin
 * @date 2021-05-11
 */
@RestController
@RequestMapping("/operation/metadatavalue")
public class SysmMetadatavalueController extends BaseController
{
    @Autowired
    private ISysmMetadatavalueService sysmMetadatavalueService;

    /**
     * 查询元数据管理列表
     */
    @PreAuthorize("@ss.hasPermi('operation:metadatavalue:list')")
    @GetMapping("/list")
    public AjaxResult list(SysmMetadatavalue sysmMetadatavalue)
    {
        List<SysmMetadatavalue> list = sysmMetadatavalueService.selectSysmMetadatavalueList(sysmMetadatavalue);
        return AjaxResult.success(list);
    }

    /**
     * 导出元数据管理列表
     */
    @PreAuthorize("@ss.hasPermi('operation:metadatavalue:export')")
    @Log(title = "元数据管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SysmMetadatavalue sysmMetadatavalue)
    {
        List<SysmMetadatavalue> list = sysmMetadatavalueService.selectSysmMetadatavalueList(sysmMetadatavalue);
        ExcelUtil<SysmMetadatavalue> util = new ExcelUtil<SysmMetadatavalue>(SysmMetadatavalue.class);
        return util.exportExcel(list, "metadatavalue");
    }

    /**
     * 获取元数据管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('operation:metadatavalue:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(sysmMetadatavalueService.selectSysmMetadatavalueById(id));
    }

    /**
     * 新增元数据管理
     */
    @PreAuthorize("@ss.hasPermi('operation:metadatavalue:add')")
    @Log(title = "元数据管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysmMetadatavalue sysmMetadatavalue)
    {
        return toAjax(sysmMetadatavalueService.insertSysmMetadatavalue(sysmMetadatavalue));
    }

    /**
     * 修改元数据管理
     */
    @PreAuthorize("@ss.hasPermi('operation:metadatavalue:edit')")
    @Log(title = "元数据管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysmMetadatavalue sysmMetadatavalue)
    {
        return toAjax(sysmMetadatavalueService.updateSysmMetadatavalue(sysmMetadatavalue));
    }

    /**
     * 删除元数据管理
     */
    @PreAuthorize("@ss.hasPermi('operation:metadatavalue:remove')")
    @Log(title = "元数据管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(sysmMetadatavalueService.deleteSysmMetadatavalueByIds(ids));
    }
}
